package com.fms.fmsapi.common;

import lombok.Getter;

@Getter  //lombok中的注解，用于给枚举类生成getter方法
//@Data只能用于class类型
public enum ResponseEnum {

    SUCCESS(200, "success"),

    ERROR(404, "error"),
    /* 用户错误  201 - 299  */
    USER_NOT_LOGIN(201,"用户未登录"),
    INVALID_TOKEN(202, "无效Token信息"),
    USER_NOT_EXIST(203,"用户不存在"),
    USER_LOGIN_ERROR(204,"登陆失败，账号或者密码有误"),
    TOKEN_EXPIRED(205,"Token已过期"),
    ERROR_AUTH_CODE(206,"验证码错误"),
    CODE_EMPTY(207,"CODE不存在"),
    USER_UPDATA_ERROR(209,"用户更新失败"),

    ;//可一键给字段赋值，只需要ResponseEnum.SUCCESS就可以进行调用了,此时enum里面的code=1,msg="success"

    private Integer code;//结果码

    private String msg;//信息

    ResponseEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }//构造方法

    public void setCode(Integer code) {
        this.code = code;
    }//setter

    public void setMsg(String msg) {
        this.msg = msg;
    }
}